package com.bwhx.eruler.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.bwhx.eruler.bean.Buyer;
import com.bwhx.eruler.bean.CScanData;
import com.bwhx.eruler.bean.Customer;
import com.bwhx.eruler.bean.Page;
import com.bwhx.eruler.bean.SdkData;
import com.bwhx.eruler.bean.User;
import com.bwhx.eruler.dao.CustomerDao;
import com.bwhx.eruler.dao.SdkDataDao;

/**
 * @Description:
 */
@Repository
public class SdkDataDaoImpl extends BaseDaoImpl<SdkData> implements SdkDataDao {
	public SdkDataDaoImpl() {
		this.setNs("com.bwhx.eruler.mapper.SdkDataMapper.");
	}

	/*@Override
	public List<Customer> findByMId(int m_id) {
		
		return getSqlSession().selectList("com.bwhx.eruler.mapper.CustomerMapper." + "findByMId", m_id);
		
	}
	
	@Override
	public void insert(Customer customer) {
		List<CScanData> scanDatas = customer.getScanDatas();
		this.getSqlSession().insert("com.bwhx.eruler.mapper.CustomerMapper." + "insert", customer);
		int keyFromDB = customer.getId();
		for (CScanData cScanData : scanDatas) {
			cScanData.setUserid(keyFromDB);
			log.info(cScanData+"+++++++++++++++++++++++++++++++++++++++++++++++");
		}
		this.getSqlSession().insert("com.bwhx.eruler.mapper.CScanDataMapper." + "insert", scanDatas);
		
		
		
		
	}

	@Override
	public List<Customer> list(Page p) {
		return getSqlSession().selectList("com.bwhx.eruler.mapper.CustomerMapper." + "list",p);
	}

	@Override
	public Integer count(Customer customer) {
		Object selectOne = getSqlSession().selectOne("com.bwhx.eruler.mapper.CustomerMapper." + "count",customer);
		if(null!=selectOne && selectOne instanceof Integer){
			return (int)selectOne;
		}
		return 0;
	}

	@Override
	public List<CScanData> listScanData(Page p) {
		return getSqlSession().selectList("com.bwhx.eruler.mapper.CScanDataMapper." + "list",p);
	}

	@Override
	public Integer countScanData(Integer userid) {
		Object selectOne = getSqlSession().selectOne("com.bwhx.eruler.mapper.CScanDataMapper." + "count",userid);
		if(null!=selectOne && selectOne instanceof Integer){
			return (int)selectOne;
		}
		return 0;	}*/

}
